package com.homework.ch04;

import java.lang.reflect.Method;
import java.util.Random;

/**
 * @author yang
 * @date 2024-03-26
 */
public class Student {
    private String name;
    private Double score;
    private String address;
    private Double hour;

    public Student(String name, Double score) {
        this.name = name;
        this.score = score;
    }
    private int study(String address,Double hour) throws Exception{
        System.out.println(this.name+"在"+address+"学习了"+hour+"个小时");
        //Ramdom random = new Random()
        Class<Random> randomClass = Random.class;
        Random random = randomClass.getConstructor().newInstance();
        //random.nextInt(101)
        Method method = randomClass.getMethod("nextInt",int.class);
        int invoke = (int) method.invoke(random,101);
        return invoke;
    }
}
